<?php 
/*
# ------------------------------------------------------------------------
# JA Job Board Package
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
# Author: JoomlArt.com
# Websites: http://www.joomlart.com - http://www.joomlancers.com.
# ------------------------------------------------------------------------
*/
defined('_JEXEC') or die('Restricted access');
global $jbconfig;
$this->config = $jbconfig; 
$limitstart = JRequest::getVar('limitstart', '0', '', 'int');
$user =& JFactory::getUser();
//Ordering allowed ?
$lists = $this->lists;
$rows = $this->items;

$page = $this->pageNav;
$ordering = ($lists['filter_order'] == 'c.ordering');
JHTML::_('behavior.tooltip');

?>
<center>
<div style="width: 90%; border: 1px solid rgb(153, 153, 153); padding: 4px; text-align: left; background: #FFFFDD">
 		<img border="0" src="../includes/js/ThemeOffice/warning.png" alt="Tooltip"/>
 		<?php echo JText::_("WARNING MSG SUBSCIPTION DEFAULT");?>
</div>
</center>
<br/>

<form action="index.php" method="post" name="adminForm" class="content-right">
	<table width="100%">
	<tr>
	
		<td width="80%" valign="top">
			<table>
	
				<tr>
					<td align="left" width="100%">
						<?php echo JText::_( 'Filter' ); ?>:
							<input type="text" name="search" id="search" value="<?php echo $lists['search'];?>" class="text_area" onchange="document.adminForm.submit();" />
							<button onclick="this.form.submit();"><?php echo JText::_( 'GO' ); ?></button>
							<button onclick="document.getElementById('search').value=''; document.getElementById('filter_type').value='';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
					</td>
					<td>
						<?php 
							echo $this->filter_type;
						?>
					</td>
				</tr>
			</table>
		
	
		    <div style="width:100%;">	
			
			<table class="adminlist">
			<thead>
					<tr>
						<th width="10" align="left">
							<?php echo JText::_( 'NUM' ); ?>
						</th>
						<th width="20">
							<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $rows);?>);" />
						</th>
						<th class="title">
							<?php echo JHTML::_('grid.sort',   JText::_('Title'), 's.title', @$lists['filter_order_Dir'], @$lists['filter_order'] ); ?>
						</th>
						<th class="title" width="10%">
							<?php echo JHTML::_('grid.sort',   JText::_('Default'), 's.isdefault', @$lists['filter_order_Dir'], @$lists['filter_order'] ); ?>
						</th>
						<th width="10%">
							<?php echo JHTML::_('grid.sort',   JText::_('Published'), 's.published', @$lists['filter_order_Dir'], @$lists['filter_order'] ); ?>
						</th>
						<th width="15%">
							<?php echo JHTML::_('grid.sort',   JText::_('Subscription type'), 's.subs_type', @$lists['filter_order_Dir'], @$lists['filter_order'] ); ?>
						</th>
						<th width="10%">
							<?php if( $this->config['currency']->get('mode')=='special_currency' ){?>
									<?php $currency = $this->config['currency']->get('currency_symbol', 'credit');?> 
								<?php }else{?>
									<?php $currency =  $this->config['currency']->get('currency', '$');?> 
								<?php }?>
							<?php echo JHTML::_('grid.sort',   JText::_('Cost').' ('.$currency.')', 's.cost', @$lists['filter_order_Dir'], @$lists['filter_order'] ); ?> 
						</th>
						<th width="15%">
							<?php echo JHTML::_('grid.sort',   JText::_('Duration'), 's.duration', @$lists['filter_order_Dir'], @$lists['filter_order'] ); ?>
						</th>
						<th width="5%" nowrap="nowrap">
							<?php echo JHTML::_('grid.sort',   JText::_('ID'), 's.id', @$lists['filter_order_Dir'], @$lists['filter_order'] ); ?>
						</th>
					</tr>
				</thead>
				<tfoot>
				<tr>
					<td colspan="13">
						<?php echo $page->getListFooter(); ?>
					</td>
				</tr>
				</tfoot>
				<tbody>
					<?php
					$k = 0;
					for ($i=0, $n=count( $rows ); $i < $n; $i++)
					{
						$row = $rows[$i];
						$checked 	= JHTML::_('grid.id',   $i, $row->id );
						//$link 		= JRoute::_( 'index.php?option=com_hello&controller=hello&task=edit&cid[]='. $row->id );
						JFilterOutput::objectHtmlSafe($row);
				
							$row->sect_link = JRoute::_( "index.php?option={$lists['option']}&task=edit&cid[]=$row->id" );
				
							$link = "index.php?option={$lists['option']}&view=jasubscriptions&task=edit&cid[]=$row->id" ;
							$published 	= JHTML::_('grid.published', $row, $i );
							$chose = ($row->require_approved ==1)?'checked ="checked"':'';
							$approved 	=($row->require_approved ==1)?'<a title="Approved Item" onclick="return listItemTask(\'cb'.$i.'\',\'unapproved\')" href="javascript:void(0);"><img border="0" alt="Approved" src="images/tick.png"/></a>':'<a title="Unapproved Item" onclick="return listItemTask(\'cb'.$i.'\',\'approved\')" href="javascript:void(0);"><img border="0" alt="Unapproved" src="images/publish_x.png"/>';
						?>
						<tr class="<?php echo "row$k"; ?>">
								<td>
									<?php echo $page->getRowOffset( $i ); ?>
								</td>
								<td>
									<?php echo $checked; ?>
								</td>
								<td>
									<span class="editlinktip hasTip" title="<?php echo JText::_( 'TITLE' );?>::<?php echo $row->title; ?>">
									<?php
//									if (  JTable::isCheckedOut($user->get ('id'), $row->checked_out )  ) {
//										echo $row->title;
//									} else {
										?>
										<a href="<?php echo JRoute::_( $link ); ?>">
											<?php echo $row->title; ?></a>
										<?php
//									}
									?></span>
								</td>
								<td align="center">
									<?php if ($row->isdefault == 1) {?>
										<img src="templates/khepri/images/menu/icon-16-default.png" alt="<?php //echo JText::_( 'Default' ); ?>" />
									<?php }?>&nbsp;
								</td>
								<td align="center">
									<?php echo $published;?>
								</td>
								<td align="center">
								<?php
								$arr_subtype = JobBoardConstant::getSub_Type();
								 echo $arr_subtype[$row->subs_type];?>
								</td>
								<td align="right">
									<?php echo $row->price;?>
								</td>
								<td align="right">
									<?php echo $row->duration==-1? JText::_('Lifetime') : $row->duration. ' ' . $row->units;?>
								</td>
								<td align="center">
									<?php echo $row->id; ?>
								</td>
							</tr>
						<?php
						$k = 1 - $k;
					}
					?>
				</tbody>
			</table>
		</div>
		</td>
	</tr>
	</table>
<input type="hidden" name="filter_order" value="<?php echo $lists['filter_order']; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $lists['filter_order_Dir']; ?>" />
<input type="hidden" name="option" value="<?php echo $lists['option']; ?>" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="view" value="jasubscriptions" />
</form>

